﻿@page "/archive"
@model IndexModel
@inject IOptionsSnapshot<SiteOptions> SiteOptions
@{
    ViewData["Title"] = "归档";
}


@if (Model.BlogPosts is {Count:>0})
{
@section Headers{
    <link rel="stylesheet" href="~/css/blogpost.css"/>
}
    <div id="nice">
        <ul>
            @foreach (var groupYear in Model.BlogPosts.GroupBy(x => x.CreationTime.ToString("yyyy年")).OrderByDescending(x => x.Key))
            {
                <li>
                    <h2>@groupYear.Key</h2>
                    <ul>
                        @foreach (var groupMonth in groupYear.GroupBy(x => x.CreationTime.ToString("yyyy年MM月")).OrderByDescending(x => x.Key))
                        {
                            <li>
                                <h3>@groupMonth.Key</h3>
                                <ol>
                                    @foreach (var blogPost in groupMonth.OrderByDescending(x => x.CreationTime))
                                    {
                                        <li>
                                            <h4 class="mt-0 mb-1 font-16">
                                                <a style="color: #262626;" href="/@blogPost.CreationTime.ToString("yyyy/MM")/@blogPost.Slug">@blogPost.Title</a>
                                            </h4>
                                            <p class="text-muted">
                                                ---<small>@blogPost.CreationTime.ToString("yyyy年MM月dd日 hh:mm:ss")</small>
                                            </p>
                                        </li>
                                    }
                                </ol>
                            </li>
                        }
                    </ul>
                </li>
            }
        </ul>
    </div>
}